package main

import (
	"COUNTER/implement"
	"fmt"
	"sync"
)

func main() {

	var wg sync.WaitGroup
	counter := implement.SafeCounter{}

	// 并发地增加计数器
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			counter.Increment()
		}()
	}

	// 等待所有 goroutine 完成
	wg.Wait()

	fmt.Println("Final counter value:", counter.Value())

}
